# -*- encoding: utf-8 -*-
from wx.lib.embeddedimage import PyEmbeddedImage
import pic
import wx, wx.xrc
import sys

class MyApp(wx.App):
    def OnInit(self):
        self.RedirectStdio("err.log")
        self.res = wx.xrc.XmlResource("my.xrc")
        self.InitFrame()
        self.Show()
        return True

    def InitFrame(self):
        self.frame = self.res.LoadFrame(None, "MainFrame")
        self.panel = wx.xrc.XRCCTRL(self.frame, "MainPanel")
        self.list = wx.ListCtrl(self.panel, wx.NewId(),
#                                style=wx.LC_REPORT
#                                | wx.BORDER_NONE
#                                | wx.LC_EDIT_LABELS
#                                | wx.LC_SORT_ASCENDING
                                )
        self.list.InsertColumn(0, "Artist")
        self.list.InsertColumn(1, "Title")
        self.list.InsertColumn(2, "Genre")

        box = wx.BoxSizer(wx.VERTICAL)
        box.Add(self.list, 1, wx.EXPAND|wx.ALL, 5)
        self.panel.SetSizer(box)

        self.il = wx.ImageList(32, 32)
        bmp = PyEmbeddedImage(pic.pic1).GetBitmap()
        self.idx1 = self.il.Add(bmp)
        self.list.SetImageList(self.il, wx.IMAGE_LIST_SMALL)

        self.list.InsertImageStringItem(0, 'hello', self.idx1)
        
    def Show(self):
        self.SetTopWindow(self.frame)
        self.frame.Show()

app = MyApp()
app.MainLoop()